#include "junix.h"

int main(int argc, char **argv)
{
	std::string pattern = "+-%^&@~%#*<>()[]=!;\'\"\t\n \v,.";
	std::ifstream file(__FILE__);
	std::string line;
	std::vector<std::string> words;

	while(getline(file, line))
	{
		std::string::size_type pos;
		while( (pos=line.find_first_of(pattern)) != std::string::npos)
		{
			if(pos == 0)
			{
				line.erase(line.begin());
				continue;
			}

			std::string word(line,0,pos);
			words.push_back(word);
			line.erase(line.begin(),line.begin()+pos);
		}
	}

	std::sort(words.begin(), words.end());
	words.erase(std::unique(words.begin(),words.end()),
			words.end());

	std::copy(words.begin(), words.end(),
			std::ostream_iterator<std::string>(std::cout, "\n"));

	std::cout<<"size:"<<words.size()<<std::endl;
}
